<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "authorize_token".
 *
 * @property integer $qtk_uid
 * @property string $taobao_user_id
 * @property string $taobao_user_nick
 * @property string $token
 * @property string $token_time
 * @property string $refresh_token
 * @property string $create_time
 * @property integer $status
 */
class AuthorizeToken extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'authorize_token';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['qtk_uid', 'taobao_user_id', 'token_time', 'create_time'], 'required'],
            [['qtk_uid', 'taobao_user_id', 'status'], 'integer'],
            [['token_time', 'create_time'], 'safe'],
            [['taobao_user_nick', 'token', 'refresh_token'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'qtk_uid' => Yii::t('app', '淘客uid'),
            'taobao_user_id' => Yii::t('app', '淘宝id'),
            'taobao_user_nick' => Yii::t('app', '淘宝账号昵称'),
            'token' => Yii::t('app', '授权码'),
            'token_time' => Yii::t('app', '授权码时间'),
            'refresh_token' => Yii::t('app', '刷新授权码'),
            'create_time' => Yii::t('app', '创建时间'),
            'status' => Yii::t('app', '授权状态 , 1=正常 , 2=授权过期'),
        ];
    }
    public static function getDb()
    {
        return Yii::$app->get('qtk');
    }
}
